using AspireFyh.ApiService.Context;
using AspireFyh.ApiService.Services;
using Microsoft.EntityFrameworkCore;
using MySqlConnector;

var builder = WebApplication.CreateBuilder(args);

// Add service defaults & Aspire components.
builder.AddServiceDefaults();
builder.AddMySqlDbContext<MyDbContext>("clouddb");

// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddProblemDetails();
builder.Services.AddScoped<IAccountService,AccountService>();

var app = builder.Build();

if (app.Environment.IsDevelopment())
{
}

// Configure the HTTP request pipeline.
app.UseHttpsRedirection();
// app.MapGet("/account", async (MyDbContext context) =>
// {
//     var accounts = await context.Accounts.ToArrayAsync();
//     return accounts;
// });
//app.MapGrpcService<AccountService>();
app.MapControllers();

app.Run();